package com.bluelight.expertsystemmobile.versionupdate.action;

import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.ParentPackage;
import org.apache.struts2.convention.annotation.Result;
import org.apache.struts2.json.annotations.JSON;
import org.springframework.beans.factory.annotation.Autowired;

import com.bluelight.expertsystemmobile.versionupdate.dao.VersionDao;
import com.bluelight.expertsystemmobile.versionupdate.entity.Version;

import support.action.BaseAction;

@ParentPackage(value = "json-default")
@Namespace("/")
@Action(value = "/versionQuery", results = { @Result(name = "json", type = "json"), @Result(name = "success", location = "/index.jsp") })
public class VersionAction extends BaseAction {

	private static final long serialVersionUID = 1L;

	@Autowired
	private VersionDao versionDao;
	private Version version;
	@Override
	public String execute() throws Exception {
		version = versionDao.queryNewVersion(version.getVersionNumber());
		return JSON;
	}
	@JSON
	public Version getVersion() {
		return version;
	}
	public void setVersion(Version version) {
		this.version = version;
	}

}
